package com.skywolf.chem.common.sysconfig.mybatisplus;

/**
 * Created by pei_pei on 2020/10/27.
 */
import com.baomidou.mybatisplus.core.MybatisConfiguration;
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.transaction.annotation.EnableTransactionManagement;

@ConditionalOnClass({MybatisConfiguration.class})
@EnableTransactionManagement
@Configuration
public class MybatisPlusConfig {
    public MybatisPlusConfig() {
    }

    @ConditionalOnMissingBean
    @Bean
    public PaginationInterceptor paginationInterceptor() {
        PaginationInterceptor paginationInterceptor = new PaginationInterceptor();
        return paginationInterceptor;
    }
}
